package cn.kmsoft.stgeometry.constant;

/**
 * 数据库类型
 */
public enum DBType {
    ORACLE(10000, "oracle"),
    POSTGRESQL(10001, "postgresql");

    private int dbCode;
    private String typeName;

    private DBType(int dbCode, String typeName) {
        this.dbCode = dbCode;
        this.typeName = typeName;
    }

    public int getDbCode() {
        return dbCode;
    }
    public void setDbCode(int dbCode) {
        this.dbCode = dbCode;
    }

    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    // 根据value返回枚举类型,主要在switch中使用
    public static DBType getDBTypeByName(String typeName) {
        for (DBType dbType : values()) {
            if (dbType.getTypeName().equalsIgnoreCase(typeName) ) {
                return dbType;
            }
        }
        return null;
    }


    }
